/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.Model.Repositories;

import com.Model.AcervoConteudo;
import com.thoughtworks.xstream.XStream;
import java.util.List;

/**
 *
 * @author Fellipe
 */
public class AcervoConteudoRepository {

    private com.Clientes.AcervoConteudo.AcervoConteudo_Service service = new com.Clientes.AcervoConteudo.AcervoConteudo_Service();
    private com.Clientes.AcervoConteudo.AcervoConteudo port = service.getAcervoConteudoPort();
    private XStream xstream = new XStream();

    public AcervoConteudo read(int chaveConteudo) {
        return fromXML(port.read(chaveConteudo));
    }
    
    public List<AcervoConteudo> busca(String busca, int chave) {
        return fromXMLList(port.busca(busca, chave));
    }

    private String toXML(AcervoConteudo ac) {
        return xstream.toXML(ac);
    }

    private AcervoConteudo fromXML(String xml) {
        return (AcervoConteudo) xstream.fromXML(xml);
    }
    
    private List<AcervoConteudo> fromXMLList(String xml) {
        return (List<AcervoConteudo>) xstream.fromXML(xml);
    }
}
